<div class="page-add-new-article">
    <div id="content-header">
        <h1><a href="/admin/node/Terms/index/<?php echo $typeId;?>">NodeType</a> / <?php echo __d('system','Edit Term');?></h1>
    </div>
    <div class="container-fluid">
     <div class="row-fluid">
      <div class="span12">
        <?php
            echo $this->Form->create('Term', array('id' => 'paginate','class'=>'form-horizontal', 'action' => 'edit', 'url' => $this->request->here(false), 'type' => 'file',
                'inputDefaults' => array('label' => false, 'format' => array('before', 'label', 'between', 'input', 'after', 'error'))));
            //echo $this->element('toolbar');
        ?>									
        
            <?php

                $fieldsets['type_id'] = $this->Form->input('type_id', array(
                    'label' => array('class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',
                    'value' => $typeId,
                    'type' => 'hidden'));
                $fieldsets['name'] = $this->Form->input('name', array(
                    'label' => array('text'=>__d('system','Name'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',
                    'type' => 'text'));

                $fieldsets['parent_id'] = $this->Form->input('parent_id', array(
                    'label' => array('class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',
                    'type' => 'select',
                    'options' => $menus,
                    'empty' => '-- None --',
                    'escape' => false));                    
                $fieldsets['description'] = $this->Form->input('description', array(
                    'label' => array('text'=>__d('system','Description'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',
                    'type' => 'textarea'));
                $fieldsets['image'] = $this->Form->input('image', array(
                    'label' => array('text'=>__d('system','Image'),'class' => 'control-label'),
                    'between' => '<div class="controls">',
                    'div' => array('class' => 'control-group'),
                    'after' => '</div>',
                    'type' => 'file'));    
            ?>      

            <?php
                echo $this->Layout->form($_layouts, $fieldsets);
            ?>
            <div class="form-actions form-actions-two">
                <?php  echo $this->element('toolbar');?>
            </div>
        <?php
            echo $this->Form->hidden('Paginate.task', array('id' => 'task', 'value' => ''));
            echo $this->Form->end();
        ?>        								
    </div>	
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function($){
    $('<span>Size: 1600x850</span>').insertAfter("#NodeFieldBackgroundImage");
    $('<span>Enter a valid number: (int)</span>').insertAfter("#NodeFieldBackgroundPiority");
    $('#NodeFieldNewPostDate').datetimepicker({
        dateFormat: 'yy-mm-dd',
        timeFormat: 'hh:mm'
    });
});
function add_more(){
    var element= jQuery("#cloneImage").prev();
    jQuery(element).clone().insertBefore("#cloneImage");
    var $this = Green.Elfinder;
    jQuery('form input.file-upload').prop('readonly' , true).click(function(){
                $this.show(jQuery(this));
            });
}
function delete_image(id){
    if (confirm("Are you sure you want to delete?")) {
        var href= "<?php echo '/node/node/delete_image/'?>"+id;
        jQuery.ajax({
          url: href,
          type: "GET",
          success: function(data) {           
            jQuery('#image_'+id).remove();
            jQuery('#image_del_'+id).remove();
            //alert('Load was performed.');
          }
        });
    }
}
</script>